package com.cskaoyan.shopping.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.mall.constant.ShoppingRetCode;
import com.cskaoyan.shopping.dto.NavListResponse;
import com.cskaoyan.shopping.dto.PanelContentDto;
import com.cskaoyan.shopping.service.IContentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Ajun de BBC
 * @Date 2022/8/1 15:06
 * @Version 1.5
 */

@Slf4j
@RestController
@RequestMapping("shopping")
public class ContentController {

    @Autowired
    IContentService iContentService;

    @GetMapping("navigation")
    public ResponseData getAllContent(){
        NavListResponse response = iContentService.queryNavList();
        if(ShoppingRetCode.SUCCESS.getCode().equals(response.getCode())){
            return new ResponseUtil().setData(response.getPannelContentDtos(),response.getMsg());
        }
        return new ResponseUtil().setErrorMsg(response.getMsg());
    }
}
